<!DOCTYPE html><html lang="cn" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>redis面试题 | HustleLr</title><meta name="keywords" content="中间件,面试题"><meta name="author" content="HustleLr"><meta name="copyright" content="HustleLr"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta property="og:type" content="article">
<meta property="og:title" content="redis面试题">
<meta property="og:url" content="http://greenfivebird.gitee.io/hustleblog/2021/04/16/redis%E9%9D%A2%E8%AF%95%E9%A2%98/index.html">
<meta property="og:site_name" content="HustleLr">
<meta property="og:locale">
<meta property="og:image" content="http://greenfivebird.gitee.io/hustleblog/img/question.jfif">
<meta property="article:published_time" content="2021-04-16T12:23:48.000Z">
<meta property="article:modified_time" content="2022-03-06T15:18:21.829Z">
<meta property="article:author" content="HustleLr">
<meta property="article:tag" content="中间件">
<meta property="article:tag" content="面试题">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="http://greenfivebird.gitee.io/hustleblog/img/question.jfif"><link rel="shortcut icon" href="/hustleblog/img/head.jpg"><link rel="canonical" href="http://greenfivebird.gitee.io/hustleblog/2021/04/16/redis%E9%9D%A2%E8%AF%95%E9%A2%98/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/hustleblog/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/hustleblog/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: 'Copy successfully',
    error: 'Copy error',
    noSupport: 'The browser does not support'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: 'Just',
    min: 'minutes ago',
    hour: 'hours ago',
    day: 'days ago',
    month: 'months ago'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'redis面试题',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2022-03-06 23:18:21'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 5.4.1"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">Loading...</div></div></div><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="/hustleblog/img/head.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data is-center"><div class="data-item"><a href="/hustleblog/archives/"><div class="headline">Articles</div><div class="length-num">17</div></a></div><div class="data-item"><a href="/hustleblog/tags/"><div class="headline">Tags</div><div class="length-num">12</div></a></div><div class="data-item"><a href="/hustleblog/categories/"><div class="headline">Categories</div><div class="length-num">12</div></a></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/hustleblog/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/hustleblog/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/hustleblog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/hustleblog/link/"><i class="fa-fw fas fa-link"></i><span> 外链</span></a></div><div class="menus_item"><a class="site-page" href="/hustleblog/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('/hustleblog/img/question.jfif')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/hustleblog/">HustleLr</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/hustleblog/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/hustleblog/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></div><div class="menus_item"><a class="site-page" href="/hustleblog/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page" href="/hustleblog/link/"><i class="fa-fw fas fa-link"></i><span> 外链</span></a></div><div class="menus_item"><a class="site-page" href="/hustleblog/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">redis面试题</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">Created</span><time class="post-meta-date-created" datetime="2021-04-16T12:23:48.000Z" title="Created 2021-04-16 20:23:48">2021-04-16</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2022-03-06T15:18:21.829Z" title="Updated 2022-03-06 23:18:21">2022-03-06</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/hustleblog/categories/%E9%9D%A2%E8%AF%95%E9%A2%98/">面试题</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="redis面试题"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">Post View:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><script type="text&#x2F;javascript" src="https://unpkg.com/kity@2.0.4/dist/kity.min.js"></script><script type="text&#x2F;javascript" src="https://unpkg.com/kityminder-core@1.4.50/dist/kityminder.core.min.js"></script><script defer="true" type="text&#x2F;javascript" src="https://unpkg.com/hexo-simple-mindmap@0.8.0/dist/mindmap.min.js"></script><link rel="stylesheet" type="text&#x2F;css" href="https://unpkg.com/hexo-simple-mindmap@0.8.0/dist/mindmap.min.css"></article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">Author: </span><span class="post-copyright-info"><a href="mailto:undefined">HustleLr</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">Link: </span><span class="post-copyright-info"><a href="http://greenfivebird.gitee.io/hustleblog/2021/04/16/redis%E9%9D%A2%E8%AF%95%E9%A2%98/">http://greenfivebird.gitee.io/hustleblog/2021/04/16/redis%E9%9D%A2%E8%AF%95%E9%A2%98/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">Copyright Notice: </span><span class="post-copyright-info">All articles in this blog are licensed under <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a> unless stating additionally.</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/hustleblog/tags/%E4%B8%AD%E9%97%B4%E4%BB%B6/">中间件</a><a class="post-meta__tags" href="/hustleblog/tags/%E9%9D%A2%E8%AF%95%E9%A2%98/">面试题</a></div><div class="post_share"><div class="social-share" data-image="/hustleblog/img/question.jfif" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-full"><a href="/hustleblog/2021/06/23/kafka%E9%9D%A2%E8%AF%95%E9%A2%98/"><img class="prev-cover" src="/hustleblog/img/question.jfif" onerror="onerror=null;src='/hustleblog/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">Previous Post</div><div class="prev_info">kafka面试题</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>Related Articles</span></div><div class="relatedPosts-list"><div><a href="/hustleblog/2021/06/23/kafka%E9%9D%A2%E8%AF%95%E9%A2%98/" title="kafka面试题"><img class="cover" src="/hustleblog/img/question.jfif" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-06-23</div><div class="title">kafka面试题</div></div></a></div><div><a href="/hustleblog/2022/03/01/Kafka%E5%85%A5%E9%97%A8/" title="Kafka入门"><img class="cover" src="/hustleblog/img/kafka.jfif" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2022-03-01</div><div class="title">Kafka入门</div></div></a></div><div><a href="/hustleblog/2022/03/06/docker%E6%93%8D%E4%BD%9C/" title="docker操作"><img class="cover" src="/hustleblog/img/docker.webp" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2022-03-06</div><div class="title">docker操作</div></div></a></div><div><a href="/hustleblog/2022/03/01/es%E5%85%A5%E9%97%A8/" title="es入门"><img class="cover" src="/hustleblog/img/es.jfif" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2022-03-01</div><div class="title">es入门</div></div></a></div><div><a href="/hustleblog/2022/03/03/%E5%88%86%E5%B8%83%E5%BC%8F%E9%94%81/" title="分布式锁"><img class="cover" src="/hustleblog/img/suo.jfif" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2022-03-03</div><div class="title">分布式锁</div></div></a></div><div><a href="/hustleblog/2022/03/01/redis%E9%9B%86%E7%BE%A4/" title="redis集群"><img class="cover" src="/hustleblog/img/redis.jfif" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2022-03-01</div><div class="title">redis集群</div></div></a></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="/hustleblog/img/head.jpg" onerror="this.onerror=null;this.src='/hustleblog/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">HustleLr</div><div class="author-info__description"></div></div><div class="card-info-data is-center"><div class="card-info-data-item"><a href="/hustleblog/archives/"><div class="headline">Articles</div><div class="length-num">17</div></a></div><div class="card-info-data-item"><a href="/hustleblog/tags/"><div class="headline">Tags</div><div class="length-num">12</div></a></div><div class="card-info-data-item"><a href="/hustleblog/categories/"><div class="headline">Categories</div><div class="length-num">12</div></a></div></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>Announcement</span></div><div class="announcement_content">Welcome to Wlr's Blog</div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>Recent Post</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/hustleblog/2024/04/21/%E4%BB%A3%E7%A0%81%E9%9A%8F%E6%83%B3%E5%BD%95Day-2/" title="代码随想录Day 2"><img src="/hustleblog/img/code.png" onerror="this.onerror=null;this.src='/hustleblog/img/404.jpg'" alt="代码随想录Day 2"/></a><div class="content"><a class="title" href="/hustleblog/2024/04/21/%E4%BB%A3%E7%A0%81%E9%9A%8F%E6%83%B3%E5%BD%95Day-2/" title="代码随想录Day 2">代码随想录Day 2</a><time datetime="2024-04-20T16:31:56.000Z" title="Created 2024-04-21 00:31:56">2024-04-21</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/hustleblog/2024/04/17/%E4%BB%A3%E7%A0%81%E9%9A%8F%E6%83%B3%E5%BD%95Day-1/" title="代码随想录Day 1"><img src="/hustleblog/img/code.png" onerror="this.onerror=null;this.src='/hustleblog/img/404.jpg'" alt="代码随想录Day 1"/></a><div class="content"><a class="title" href="/hustleblog/2024/04/17/%E4%BB%A3%E7%A0%81%E9%9A%8F%E6%83%B3%E5%BD%95Day-1/" title="代码随想录Day 1">代码随想录Day 1</a><time datetime="2024-04-17T14:26:46.000Z" title="Created 2024-04-17 22:26:46">2024-04-17</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/hustleblog/2022/07/11/Gateway%E8%AE%B0%E5%BD%95/" title="Gateway记录"><img src="/hustleblog/img/gateway.webp" onerror="this.onerror=null;this.src='/hustleblog/img/404.jpg'" alt="Gateway记录"/></a><div class="content"><a class="title" href="/hustleblog/2022/07/11/Gateway%E8%AE%B0%E5%BD%95/" title="Gateway记录">Gateway记录</a><time datetime="2022-07-11T08:28:45.000Z" title="Created 2022-07-11 16:28:45">2022-07-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/hustleblog/2022/04/01/%E6%9E%84%E5%BB%BA%E4%BA%8C%E5%8F%89%E6%A0%91/" title="构建二叉树"><img src="/hustleblog/img/%E4%BA%8C%E5%8F%89%E6%A0%91.webp" onerror="this.onerror=null;this.src='/hustleblog/img/404.jpg'" alt="构建二叉树"/></a><div class="content"><a class="title" href="/hustleblog/2022/04/01/%E6%9E%84%E5%BB%BA%E4%BA%8C%E5%8F%89%E6%A0%91/" title="构建二叉树">构建二叉树</a><time datetime="2022-03-31T16:29:49.000Z" title="Created 2022-04-01 00:29:49">2022-04-01</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/hustleblog/2022/03/22/Java%E5%B8%B8%E8%A7%81%E5%87%A0%E7%A7%8D%E6%8E%92%E5%BA%8F/" title="Java常见几种排序"><img src="/hustleblog/img/sort.webp" onerror="this.onerror=null;this.src='/hustleblog/img/404.jpg'" alt="Java常见几种排序"/></a><div class="content"><a class="title" href="/hustleblog/2022/03/22/Java%E5%B8%B8%E8%A7%81%E5%87%A0%E7%A7%8D%E6%8E%92%E5%BA%8F/" title="Java常见几种排序">Java常见几种排序</a><time datetime="2022-03-22T09:51:45.000Z" title="Created 2022-03-22 17:51:45">2022-03-22</time></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('/hustleblog/img/question.jfif')"><div id="footer-wrap"><div class="copyright">&copy;2019 - 2024 By HustleLr</div><div class="footer_custom_text">Welcome to HustleLr's Blog</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="Read Mode"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="Toggle Between Light And Dark Mode"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="Toggle between single-column and double-column"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="Setting"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="Back To Top"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/hustleblog/js/utils.js"></script><script src="/hustleblog/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"></div><script defer="defer" id="ribbon" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-ribbon.min.js" size="150" alpha="0.6" zIndex="-1" mobile="false" data-click="true"></script><script id="click-show-text" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-show-text.min.js" data-mobile="false" data-text="有,志,者,事,竟,成" data-fontsize="15px" data-random="false" async="async"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>